package com.onemile.controls;

import java.util.ArrayList;

import com.onemile.app.R;
import com.onemile.entity.model.ECommodity;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class AdpLV_SettleCommodityList extends BaseAdapter
{
   private LayoutInflater mInflater;
   private Context mContext;
   private ArrayList<ECommodity> mList;
   
   public AdpLV_SettleCommodityList(Context context,ArrayList<ECommodity> list)
   {
	  mContext=context;
	  mInflater=LayoutInflater.from(context);
	  mList=list;
   }
   
   @Override
   public int getCount()
   {
	  return mList.size();
   }

   @Override
   public Object getItem(int positiion)
   {
	  return mList.get(positiion);
   }

   @Override
   public long getItemId(int arg0)
   {
	  return 0;
   }

   @Override
   public View getView(int position, View currentView, ViewGroup arg2)
   {
      currentView=mInflater.inflate(R.layout.settlecommoditylist_item, null);
      
      TextView name=(TextView)currentView.findViewById(R.id.txtName_settlecommodity_item);
      TextView num=(TextView)currentView.findViewById(R.id.txtNum_settlecommodity_item);
      
      name.setText(mList.get(position).getCommodityName());
      num.setText(String.valueOf(mList.get(position).getCount()));
	  return currentView;
   }

}
